const { log } = require('debug/src/browser');
var express = require('express');
var router = express.Router();

/* GET home page. */
router.get('/', function(req, res, next) {
  res.render('index', { title: 'Express' });
});
//请求
router.get('/api/aa', function(req, res, next) {
  res.send({
    data:{
      code:200,
      success:true,
     a:1

    }
  })
});
//get请求
router.get('/api/bb', function(req, res, next) {
  console.log(req.query.a);
  res.send({
    data:{
      code:200,
      msg:"发送成功",
      data:2222
      
    }
  })
});
//post
router.post('/api/post', function(req, res, next) {
  console.log(req.body.a);
  res.send({
    data:{
      code:200,
      a:1
    }
  })

});



module.exports = router;
